package com.cn.yz.server.miya.controller;

import org.apache.log4j.Logger;
import org.slf4j.event.Level;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class MiyaController {

	private static final Logger LOG = Logger.getLogger(MiyaController.class);
	
	@Autowired
    private RestTemplate restTemplate;
	
	@RequestMapping("/hi")
    public String home(){
        LOG.info("hi is being called");
        return "hi i'm miya!";
    }

    @RequestMapping("/miya")
    public String info(){
    	LOG.info("info is being called");
        return restTemplate.getForObject("http://localhost:8901/hiinfo",String.class);
    }


}
